package com.yyy.dm.provider.controller;

import com.yyy.dm.order.DMOrder;
import com.yyy.dm.provider.service.OrderProviderService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@RestController
public class OrderProviderController {

    @Resource
    private OrderProviderService orderProviderService;

    @PostMapping("/rollbackOrder")
    public Integer rollbackOrder(@RequestBody Long orderId){
        return orderProviderService.rollbackOrder(orderId);
    }

    @PostMapping("/findOrderByOrderNo")
    public DMOrder findOrderByOrderNo(@RequestBody String orderNo){
        return orderProviderService.findOrderByOrderNo(orderNo);
    }

    @PostMapping("/updateOrder")
    public Integer updateOrder(@RequestBody Map<String,String> map){
        return orderProviderService.updateOrder(map.get("orderNo"),map.get("trade_no"));
    }
    @PostMapping("/updateOrderStatuePay")
    public Integer updateOrderStatuePay(@RequestBody String orderNo){
        return orderProviderService.updateOrderStatuePay(orderNo);
    }
    @PostMapping("/findOrderTypeById")
    public Integer findOrderTypeById(@RequestBody Long id){
        return orderProviderService.findOrderTypeById(id);
    }

}
